home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / zoomsel.pvrx < prev   
Encoding:
Text File  |  1993-01-14  |  1.3 KB  |  54 lines

  1. /* ZoomSel.pvrx---This macro will get the coordinates of the the bounding box
  2.     of all selected objects, and zoom in exactly to those limits.
  3. Copyright © 1989 by Taliesin, Inc.
  4. Authors: Jeff Blume & Ross Cunniff
  5. Usage:  Assign to Ctrl-Key or RX tool 
  6.     The macro expects to find at least one selected object. */
  7.  
  8. /* Try to lock project window.
  9.     If can't get lock, not polite to interrupt. */
  10. 'Lock'
  11. if rc ~= 0 then exit
  12.  
  13. /* get the bounding box coords */
  14. 'SelExtent' Ext
  15. if rc ~=0 then call Error "No Objects Selected!"
  16.  
  17. /*
  18. Xborder = abs(Ext.X2-Ext.X1) / 100    /* Border around objs 1/100th of view width */
  19. Xborder = abs(Ext.X2-Ext.X1) / 10    /* Border around objs 1/10th of view width */
  20. */
  21. Xborder = abs(Ext.X2-Ext.X1) / 25
  22. /*Yborder*/    /* Border around objs 1/Xth of view height */
  23.  
  24. Ext.X1 = Ext.X1 - Xborder; Ext.Y1 = Ext.Y1 - Xborder    /* !!this assumes 0,0 is up-left!! */
  25. Ext.X2 = Ext.X2 + Xborder; Ext.Y2 = Ext.Y2 + Xborder
  26.  
  27. /* zoom into those coords */
  28. 'SetView Ext'
  29. 'Repair'
  30.  
  31. ERROR:
  32.     arg ErrTxt
  33.     if RC ~= 0 | ErrTxt ~= "" then 'GetBool ErrTxt "Cancel" "Cancel"' 
  34.     'UnLock'
  35.     exit
  36.  
  37. /*
  38. ERROR:
  39.     arg ErrTxt
  40.     if RC ~= 0 | ErrTxt ~= "" then do
  41.         'GetBool ErrTxt "Cancel" "Cancel"' 
  42.         end
  43.     'UnLock'
  44.     exit
  45.  
  46. SIGNAL ON ERROR
  47. ERROR:
  48.     if RC ~= 0 then do
  49.         call ErrCON "Must first select objects!",RC
  50.         end
  51.     'UnLock'
  52.     exit
  53. */
  54.